package org.jeecg.modules.bigdatashow.controller;

import org.jeecg.modules.bigdatashow.entity.CommonResult;
import org.jeecg.modules.bigdatashow.entity.Common;
import org.jeecg.modules.bigdatashow.entity.Traffic;
import org.jeecg.modules.bigdatashow.service.TrafficService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TrafficController {
    @Autowired
    private TrafficService trafficService;

    @GetMapping(value = "/findTrafficNumber",produces = "application/json; charset=utf-8")
    public CommonResult findTrafficNumber(){
         List<Common> trafficNumber =  trafficService.findTrafficNumber();
        if (trafficNumber != null){
            return new CommonResult(200,"右1:各种交通工具的人数信息为:",trafficNumber);
        }else {
            return new CommonResult(404,"未查询到相关信息:");
        }
    }
    @GetMapping(value = "/findTrafficVisitor",produces = "application/json; charset=utf-8")
    public CommonResult findTrafficVisitor(){
        Traffic trafficVisitor =  trafficService.findTrafficVisitor();
        if (trafficVisitor != null){
            return new CommonResult(200,"右2:各种交通工具的游客信息为:",trafficVisitor);
        }else {
            return new CommonResult(404,"未查询到相关信息:");
        }
    }
}
